package com.nbsaas.boot.marketing.rest.resource;

import com.nbsaas.boot.marketing.api.apis.MemberLevelApi;
import com.nbsaas.boot.marketing.data.entity.MemberLevel;
import com.nbsaas.boot.marketing.api.domain.request.MemberLevelRequest;
import com.nbsaas.boot.marketing.api.domain.response.MemberLevelResponse;
import com.nbsaas.boot.marketing.api.domain.simple.MemberLevelSimple;
import com.nbsaas.boot.marketing.rest.convert.MemberLevelSimpleConvert;
import com.nbsaas.boot.marketing.rest.convert.MemberLevelEntityConvert;
import com.nbsaas.boot.marketing.rest.convert.MemberLevelResponseConvert;
import com.nbsaas.boot.marketing.data.repository.MemberLevelRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   会员等级-业务接口实现
*/
@Transactional
@Service
public class MemberLevelResource extends BaseResource<MemberLevel,MemberLevelResponse, MemberLevelSimple, MemberLevelRequest>  implements MemberLevelApi {

    @Resource
    private MemberLevelRepository memberLevelRepository;

    @Override
    public JpaRepositoryImplementation<MemberLevel, Serializable> getJpaRepository() {
        return memberLevelRepository;
    }

    @Override
    public Function<MemberLevel, MemberLevelSimple> getConvertSimple() {
        return new MemberLevelSimpleConvert();
    }

    @Override
    public Function<MemberLevelRequest, MemberLevel> getConvertForm() {
        return new MemberLevelEntityConvert();
    }

    @Override
    public Function<MemberLevel, MemberLevelResponse> getConvertResponse() {
        return new MemberLevelResponseConvert();
    }




}


